#include "UpdateScoreNetworkEvent.h"
#include "Score.h"

UpdateScoreNetworkEvent::UpdateScoreNetworkEvent(int textId, int score)
{
    message.header.code = NetworkEvent::SERVER_UPDATE_SCORE;
    message.header.sizeOfData = sizeof(message) - sizeof(message.header);
    message.data.textId = textId;
    message.data.score = score;
}

UpdateScoreNetworkEvent::UpdateScoreNetworkEvent(const Header& header, const Data& data)
{
    message.header = header;
    message.data = data;
}


UpdateScoreNetworkEvent::~UpdateScoreNetworkEvent()
{
}

void* UpdateScoreNetworkEvent::getMessageBlob()
{
    return &message;
}

size_t UpdateScoreNetworkEvent::getMessageBlobSize()
{
    return sizeof(message);
}

void UpdateScoreNetworkEvent::visitScore(Score* score) const
{
    score->updateScore(message.data.textId, message.data.score);
}
